# Maintainer: Martell Malone <martellmalone@gmail.com>

_realname=conemu

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=r1093.261fe53
pkgrel=1
pkgdesc="Customizable Windows console emulator with tabs. (mingw-w64)"
arch=('any')
url="http://code.google.com/p/conemu-maximus5/"
license=("BSD New")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
options=('!strip' 'staticlibs')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")

#options=('staticlibs' 'strip')

source=("git+http://github.com/martell/ConEmu.git#branch=mingw64"
        "ConEmu.xml")
md5sums=('SKIP' 'SKIP')

pkgver() {
  cd "$srcdir/$_realname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "${srcdir}/${_realname}/src"
    make -j1 -f makefile_all_gcc WIDE=1 USERCPP="-std=c++11 -fpermissive -Wunused-variable"
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"

  if [[ $CARCH == x86_64 ]]; then
  conext=64
  fi

  cp -r "${srcdir}/${_realname}/Release/conemu.exe" "${pkgdir}${MINGW_PREFIX}/bin/ConEmu.exe"
  cp -r "${srcdir}/${_realname}/Release/conemu/ConEmuC.exe" "${pkgdir}${MINGW_PREFIX}/bin/ConEmuC${conext}.exe"
  cp -r "${srcdir}/${_realname}/Release/conemu/ConEmuCD.dll" "${pkgdir}${MINGW_PREFIX}/bin/ConEmuCD${conext}.dll"
  cp -r "${srcdir}/${_realname}/Release/conemu/ConEmuHk.dll" "${pkgdir}${MINGW_PREFIX}/bin/ConEmuHk${conext}.dll"
  cp -r "${srcdir}/conemu.xml" "${pkgdir}${MINGW_PREFIX}/bin"
}
